package com.guigu.ssyx.acl.service.impl;

import com.atguigu.ssyx.model.acl.Admin;
import com.atguigu.ssyx.vo.acl.AdminQueryVo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guigu.ssyx.acl.service.AdminService;
import com.guigu.ssyx.acl.mapper.AdminMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
* @author 代奉明
* @description 针对表【admin(用户表)】的数据库操作Service实现
* @createDate 2025-09-03 10:41:58
*/
@Service
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin>
    implements AdminService{

    @Autowired
    private AdminMapper adminMapper;
    @Override
    public IPage<Admin> selectPage(Page<Admin> adminPage, AdminQueryVo adminQueryVo) {
        String name= adminQueryVo.getName();
        LambdaQueryWrapper<Admin> adminLambdaQueryWrapper = new LambdaQueryWrapper<>();
        if(!StringUtils.isEmpty(name)){
            adminLambdaQueryWrapper.like(Admin::getName,name);
        }
        IPage<Admin> pageModel = adminMapper.selectPage(adminPage, adminLambdaQueryWrapper);


        return pageModel;
    }
}




